<?php include('header.php');


if($_GET['action']=="save"){
	
	if($_POST['password']!=$_POST['password2'])
	{
		echo"<script>alert('Password input is inconsistent! ');history.back();</script>"; 
		}
	else{
		$exec="insert into admin_user (username,password) values ('".$_POST['username']."','".$_POST['password']."')";
		$result=mysql_query($exec) or die(mysql_error());
		mysql_close();
		echo"<script>alert('Add successfully! ');window.location.href='adminlist.php';</script>"; 
		}
}
?>
<script language=javascript>
<!--
function check()
{
 if (form1.username.value=="")
 {
 alert("Please input your username!");
 form1.username.focus();
 return(false);
 }
}

//-->
</script><style type="text/css">
<!--
body,td,th {
	color: #000000;
}
body {
	background-color: #E1E1E1;
	font:"Trebuchet MS";
}
-->
</style>

<div id="wapper" style="width:980px;margin:0 auto">
  <table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent">
    <tr>
      <td class="CPanel"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
      		 <tr height="50" class="CTitle" >
                <td height="22" colspan="10" align="center" style="font-size:16px">Amin Add (<a href="adminlist.php">Admin List</a>)</td>
            </tr>
          <tr>
            <td height="40" class="font42">
                <form name="form1" method="post"  action="?action=save" onsubmit="return check()">
                <table width="100%" border="0" cellspacing="0" bordercolor="#733E3F">
                  <tr height="40">
                    <td width="19%" align="right" valign="middle">User&nbsp;</td>
                    <td width="81%">&nbsp;
                      <input name="username" type="text" id="username" value="" style="width:220px;" />
                      </td>
                  </tr>
                  <tr height="40">
                    <td align="right" valign="middle">password</span>&nbsp;</td>
                    <td>&nbsp;
                      <input name="password" type="password" id="password" style="width:220px;" />
                      </td>
                  </tr>
                  <tr height="40">
                    <td align="right" valign="middle">password Input again</span>&nbsp;</td>
                    <td>&nbsp;
                      <input name="password2" type="password" id="password2" style="width:220px;" />
                      </td>
                  </tr>
                  <tr height="40">
                  	<td align="right"></td>
                    <td><input type="submit" name="submit1" value="Submit" style="border:1px solid #CCC;" /> </td>
                  </tr>
                </table>
            </form>
              </td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td class="CPanel"></td>
    </tr>
  </TABLE>
</div>
</form>
<?php include('footer.php')?>